const {
  override,
  addWebpackAlias,
} = require("customize-cra");

const path = require("path");

if (process.env.NODE_ENV === "production") {
  process.env.GENERATE_SOURCEMAP = "false";
}

module.exports = override(
  //别名配置
  addWebpackAlias({
    "@": path.join(__dirname, "./src"),
  }),
  (config) => {
    // 去掉打包生产map文件
    // config.devtool = config.mode === 'development' ? 'cheap-module-source-map' : false;
    if (process.env.NODE_ENV === "production") {
      config.devtool = false;
    }
    return config
  }
)
